<?php
namespace Home\Model;
use Think\Model\RelationModel;

class ClassStudentModel extends RelationModel{
    //关联
    protected $_link = array(
        "student"=>array(
            "mapping_type"=>2,
            "class_name"=>"student",
            "mapping_name"=>"student",
            "foreign_key"=>"student_stu_id",
            "parent_key"=>"stu_id",
            "as_fields"=>"stu_id,stu_number,stu_name,stu_email",
        ),
    );
    //自动验证
    protected $_validate = array(
        //添加专用(导入或者申请)
        array("class_cla_id","number","班级id必须是正整数!",1,"regex",1),
        array("student_stu_id","number","学生id必须是正整数!",1,"regex",1),
        array("is_pass",array(0,1),"是否通过只有0或1!",1,"in",1),
    );
}